<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: Origami::Object</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">Origami::Object</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/origami/object_rb.html">
                origami/object.rb
                </a>
        <br />
                <a href="../../files/origami/obfuscation_rb.html">
                origami/obfuscation.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Parent module representing a <a href="PDF.html">PDF</a> <a
href="Object.html">Object</a>. <a href="PDF.html">PDF</a> specification
declares a set of primitive object types :
</p>
<ul>
<li><a href="Null.html">Null</a>

</li>
<li><a href="Boolean.html">Boolean</a>

</li>
<li><a href="Integer.html">Integer</a>

</li>
<li><a href="Real.html">Real</a>

</li>
<li><a href="Name.html">Name</a>

</li>
<li><a href="String.html">String</a>

</li>
<li><a href="Array.html">Array</a>

</li>
<li><a href="Dictionary.html">Dictionary</a>

</li>
<li><a href="Stream.html">Stream</a>

</li>
</ul>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000009">&lt;=&gt;</a>&nbsp;&nbsp;
      <a href="#M000011">copy</a>&nbsp;&nbsp;
      <a href="#M000014">indirect_parent</a>&nbsp;&nbsp;
      <a href="#M000010">is_indirect?</a>&nbsp;&nbsp;
      <a href="#M000005">new</a>&nbsp;&nbsp;
      <a href="#M000022">output</a>&nbsp;&nbsp;
      <a href="#M000017">pdf</a>&nbsp;&nbsp;
      <a href="#M000008">post_build</a>&nbsp;&nbsp;
      <a href="#M000007">pre_build</a>&nbsp;&nbsp;
      <a href="#M000020">real_type</a>&nbsp;&nbsp;
      <a href="#M000012">reference</a>&nbsp;&nbsp;
      <a href="#M000006">set_indirect</a>&nbsp;&nbsp;
      <a href="#M000018">set_pdf</a>&nbsp;&nbsp;
      <a href="#M000016">size</a>&nbsp;&nbsp;
      <a href="#M000015">to_o</a>&nbsp;&nbsp;
      <a href="#M000023">to_obfuscated_str</a>&nbsp;&nbsp;
      <a href="#M000021">to_s</a>&nbsp;&nbsp;
      <a href="#M000019">type</a>&nbsp;&nbsp;
      <a href="#M000013">xrefs</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">file_offset</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">generation</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">no</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">objstm_offset</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">parent</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000005" class="method-detail">
        <a name="M000005"></a>

        <div class="method-heading">
          <a href="#M000005" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(*cons)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates a <a href="Object.html#M000005">new</a> <a href="PDF.html">PDF</a>
<a href="Object.html">Object</a>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000005-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 272</span>
272:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">cons</span>)
273:       <span class="ruby-ivar">@indirect</span> = <span class="ruby-keyword kw">false</span>
274:       <span class="ruby-ivar">@no</span>, <span class="ruby-ivar">@generation</span> = <span class="ruby-value">0</span>, <span class="ruby-value">0</span>
275:       
276:       <span class="ruby-keyword kw">super</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">cons</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">cons</span>.<span class="ruby-identifier">empty?</span>
277:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000009" class="method-detail">
        <a name="M000009"></a>

        <div class="method-heading">
          <a href="#M000009" class="method-signature">
          <span class="method-name">&lt;=&gt;</span><span class="method-args">(obj)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Compare two objects from their respective numbers.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000009-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 311</span>
311:     <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">obj</span>)
312:       [<span class="ruby-ivar">@no</span>, <span class="ruby-ivar">@generation</span>] <span class="ruby-operator">&lt;=&gt;</span> [<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">no</span>, <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">generation</span>]
313:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000011" class="method-detail">
        <a name="M000011"></a>

        <div class="method-heading">
          <a href="#M000011" class="method-signature">
          <span class="method-name">copy</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Deep <a href="Object.html#M000011">copy</a> of an object.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000011-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 325</span>
325:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">copy</span>
326:       <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-keyword kw">self</span>))
327:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000014" class="method-detail">
        <a name="M000014"></a>

        <div class="method-heading">
          <a href="#M000014" class="method-signature">
          <span class="method-name">indirect_parent</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the indirect object which contains this object. If the current
object is already indirect, returns self.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000014-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 363</span>
363:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">indirect_parent</span> 
364:       <span class="ruby-identifier">obj</span> = <span class="ruby-keyword kw">self</span>
365:       <span class="ruby-identifier">obj</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">parent</span> <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">is_indirect?</span>
366:         
367:       <span class="ruby-identifier">obj</span>
368:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000010" class="method-detail">
        <a name="M000010"></a>

        <div class="method-heading">
          <a href="#M000010" class="method-signature">
          <span class="method-name">is_indirect?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns whether the objects is indirect, which means that it is not
embedded into another object.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000010-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 318</span>
318:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_indirect?</span>
319:       <span class="ruby-ivar">@indirect</span>
320:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <span class="method-name">output</span><span class="method-args">(data)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="Object.html#M000021">to_s</a>
</p>
        </div>
      </div>

      <div id="method-M000017" class="method-detail">
        <a name="M000017"></a>

        <div class="method-heading">
          <a href="#M000017" class="method-signature">
          <span class="method-name">pdf</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the <a href="PDF.html">PDF</a> which the object belongs to.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000017-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 387</span>
387:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pdf</span>
388:       <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_indirect?</span> <span class="ruby-keyword kw">then</span> <span class="ruby-ivar">@pdf</span>
389:       <span class="ruby-keyword kw">else</span>
390:         <span class="ruby-ivar">@parent</span>.<span class="ruby-identifier">pdf</span>
391:       <span class="ruby-keyword kw">end</span>
392:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000008" class="method-detail">
        <a name="M000008"></a>

        <div class="method-heading">
          <a href="#M000008" class="method-signature">
          <span class="method-name">post_build</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Generic method called just after the object is finalized. At this time, any
indirect object has its own number and generation identifier.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000008-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 304</span>
304:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_build</span>
305:       <span class="ruby-keyword kw">self</span>
306:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000007" class="method-detail">
        <a name="M000007"></a>

        <div class="method-heading">
          <a href="#M000007" class="method-signature">
          <span class="method-name">pre_build</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Generic method called just before the object is finalized. At this time, no
number nor generation allocation has yet been done.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000007-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 296</span>
296:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pre_build</span>
297:       <span class="ruby-keyword kw">self</span>
298:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000020" class="method-detail">
        <a name="M000020"></a>

        <div class="method-heading">
          <span class="method-name">real_type</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="Object.html#M000019">type</a>
</p>
        </div>
      </div>

      <div id="method-M000012" class="method-detail">
        <a name="M000012"></a>

        <div class="method-heading">
          <a href="#M000012" class="method-signature">
          <span class="method-name">reference</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns an indirect <a href="Object.html#M000012">reference</a> to this
object, or a <a href="Null.html">Null</a> object is this object is not
indirect.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000012-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 332</span>
332:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reference</span>
333:       <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_indirect?</span>
334:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidObjectError</span>, <span class="ruby-value str">&quot;Cannot reference a direct object&quot;</span>
335:       <span class="ruby-keyword kw">end</span>
336: 
337:       <span class="ruby-identifier">ref</span> = <span class="ruby-constant">Reference</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@no</span>, <span class="ruby-ivar">@generation</span>)
338:       <span class="ruby-identifier">ref</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">self</span>
339: 
340:       <span class="ruby-identifier">ref</span>
341:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000006" class="method-detail">
        <a name="M000006"></a>

        <div class="method-heading">
          <a href="#M000006" class="method-signature">
          <span class="method-name">set_indirect</span><span class="method-args">(dir)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sets whether the object is indirect or not. Indirect objects are allocated
numbers at build time.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000006-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 283</span>
283:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_indirect</span>(<span class="ruby-identifier">dir</span>)
284:       <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">dir</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>  <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">dir</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
285:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-value str">&quot;The argument must be boolean&quot;</span>
286:       <span class="ruby-keyword kw">end</span>
287:       
288:       <span class="ruby-ivar">@indirect</span> = <span class="ruby-identifier">dir</span>
289:       <span class="ruby-keyword kw">self</span>
290:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000018" class="method-detail">
        <a name="M000018"></a>

        <div class="method-heading">
          <a href="#M000018" class="method-signature">
          <span class="method-name">set_pdf</span><span class="method-args">(pdf)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000018-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 394</span>
394:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_pdf</span>(<span class="ruby-identifier">pdf</span>)
395:       <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_indirect?</span> <span class="ruby-keyword kw">then</span> <span class="ruby-ivar">@pdf</span> = <span class="ruby-identifier">pdf</span>
396:       <span class="ruby-keyword kw">else</span>
397:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidObjectError</span>, <span class="ruby-value str">&quot;You cannot set the PDF parent of a direct object&quot;</span>
398:       <span class="ruby-keyword kw">end</span>
399:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000016" class="method-detail">
        <a name="M000016"></a>

        <div class="method-heading">
          <a href="#M000016" class="method-signature">
          <span class="method-name">size</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the <a href="Object.html#M000016">size</a> of this object once
converted to <a href="PDF.html">PDF</a> code.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000016-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 380</span>
380:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">size</span>
381:       <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">size</span>
382:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000015" class="method-detail">
        <a name="M000015"></a>

        <div class="method-heading">
          <a href="#M000015" class="method-signature">
          <span class="method-name">to_o</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns self.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000015-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 373</span>
373:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_o</span>
374:       <span class="ruby-keyword kw">self</span>
375:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <span class="method-name">to_obfuscated_str</span><span class="method-args">(data)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="Object.html#M000021">to_s</a>
</p>
        </div>
      </div>

      <div id="method-M000021" class="method-detail">
        <a name="M000021"></a>

        <div class="method-heading">
          <a href="#M000021" class="method-signature">
          <span class="method-name">to_s</span><span class="method-args">(data)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Outputs this object into <a href="PDF.html">PDF</a> code.
</p>
<table>
<tr><td valign="top"><em>data</em>:</td><td>The object data.

</td></tr>
</table>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000021-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 485</span>
485:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">data</span>)
486:       
487:       <span class="ruby-identifier">content</span> = <span class="ruby-value str">&quot;&quot;</span>
488:       <span class="ruby-identifier">content</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{no} #{generation} obj&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">EOL</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_indirect?</span>
489:       <span class="ruby-identifier">content</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">data</span>
490:       <span class="ruby-identifier">content</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">EOL</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;endobj&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">EOL</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_indirect?</span>
491:       
492:       <span class="ruby-identifier">content</span>
493:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000019" class="method-detail">
        <a name="M000019"></a>

        <div class="method-heading">
          <a href="#M000019" class="method-signature">
          <span class="method-name">type</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the symbol <a href="Object.html#M000019">type</a> of this <a
href="Object.html">Object</a>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000019-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 475</span>
475:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type</span>
476:       <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;::&quot;</span>).<span class="ruby-identifier">last</span>.<span class="ruby-identifier">to_sym</span>
477:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000013" class="method-detail">
        <a name="M000013"></a>

        <div class="method-heading">
          <a href="#M000013" class="method-signature">
          <span class="method-name">xrefs</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns an array of references pointing to the current object.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000013-source">
<pre>
     <span class="ruby-comment cmt"># File origami/object.rb, line 346</span>
346:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xrefs</span>
347:       <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_indirect?</span>
348:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidObjectError</span>, <span class="ruby-value str">&quot;Cannot find xrefs to a direct object&quot;</span>
349:       <span class="ruby-keyword kw">end</span>
350: 
351:       <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pdf</span>.<span class="ruby-identifier">nil?</span>
352:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidObjectError</span>, <span class="ruby-value str">&quot;Not attached to any PDF&quot;</span>
353:       <span class="ruby-keyword kw">end</span>
354: 
355:       <span class="ruby-identifier">thisref</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">reference</span>
356:       <span class="ruby-ivar">@pdf</span>.<span class="ruby-identifier">objects</span>(<span class="ruby-identifier">:include_keys</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>).<span class="ruby-identifier">find_all</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Reference</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">thisref</span>)}
357:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>